﻿
'some extra attributes, not in w3 attributes list or not resoluted
Public Module extraAttributes
    Public Const autocomplete As String = "autocomplete"

    Public Enum autocomplete_enum
        [on]
        off
        [default]
    End Enum
End Module

Public Module attributeSetters
    Public Sub autocomplete(ByVal ctrl As xhtmlControl, ByVal off As Boolean)
        autocomplete(ctrl, ifoper(off, autocomplete_enum.off, autocomplete_enum.on))
    End Sub

    Public Sub autocomplete(ByVal ctrl As xhtmlControl, ByVal value As autocomplete_enum)
        assert(Not ctrl Is Nothing, "ctrl is nothing.")
        If value = autocomplete_enum.on Then
            ctrl.attributes(extraAttributes.autocomplete) = "on"
        ElseIf value = autocomplete_enum.off Then
            ctrl.attributes(extraAttributes.autocomplete) = "off"
        Else
            ctrl.attributes(extraAttributes.autocomplete) = "default"
        End If
    End Sub
End Module

Public Module attributeGetters
    Public Function autocomplete(ByVal ctrl As xhtmlControl) As autocomplete_enum
        assert(Not ctrl Is Nothing, "ctrl is nothing.")
        If strsame(ctrl.attributes(extraAttributes.autocomplete), "on", False) Then
            Return autocomplete_enum.on
        ElseIf strsame(ctrl.attributes(extraAttributes.autocomplete), "off", False) Then
            Return autocomplete_enum.off
        Else
            Return autocomplete_enum.default
        End If
    End Function
End Module